package com.up.vms.infrastructure.enums;

/**
 * Created by Andy on 2017/12/3.
 */
public enum BizeTypeCode {

    //状态码范围定义如下
    //订单 - 4开头
    //会员 - 5开头
    //产品 - 6开头
    //优惠券 - 7开头
    //活动 - 8开头
    //支付 - 9开头
    //商户 - 10开头

    USER_ALREADY_EXIST("EDI-50001","当前用户在系统中已存在"),
    USER_NOT_EXIST("EDI-50002", "当前用户在系统中不存在"),
    INVALID_INVITATION_CODE("EDI-50013", "邀请码已失效"),
    GIFT_CARD_CODE_USED("EDI-50012", "礼品卡已被领取"),
    MEMBER_REGISTERED("EDI-50011", "会员已付费注册"),

    COUPON_ALREADY_VERIFIED("EDI-70001","当前优惠券已经核销，不能再次进行核销操作"),
    COUPON_ALREADY_RECEIVED("EDI-70002","当前优惠券已经被领取，不能重复领取"),
    COUPON_NOT_EXIST("EDI-70003","优惠券不存在"),
    NOT_ALLOW_TO_RECEIVE("EDI-70004","特定用户优惠券，您无法领取"),
    CODE_ALREADY_EXCHANGED("EDI-70005","该兑换码已经被使用，不能重复使用"),
    INVALID_EXCHANGE_CODE("EDI-70006","无效的兑换码"),
    NO_PUBLISHED_COUPON("EDI-70007","当前无推广的优惠券"),

    ORDER_HAVE_UNPAID_ORDERS("EDI-40201", "您当前还有未完成的订单，请完成该订单的支付后再进行购买"),
    ORDER_HAVE_REGISTRATION("EDI-40202", "该活动您已报名，免费活动不能重复报名"),

    ACTIVITY_VOUCHER_ALREADY_VERIFIED("EDI-80101", "当前入场券已经核销，不能再次进行核销操作"),
    ACTIVITY_VOUCHER_ALREADY_EXPIRED("EDI-80102", "当前入场券已经失效，不能进行核销操作"),
    ACTIVITY_VOUCHER_NOT_ALLOW_TO_VERIFY("EDI-80103", "当前入场券尚未生效，不能进行核销操作"),
    NO_SIGN_OPEN("EDI-80201", "没有签到活动"),
    SIGN_NOT_OPEN("EDI-80202", "该活动尚未开放签到"),
    SIGN_NOT_START("EDI-80203", "该活动签到尚未开始"),
    SIGN_IS_END("EDI-80204", "该活动签到已结束"),
    SIGN_SYNC_FAILED("EDI-80205", "签到同步到互动系统失败"),
    USER_IS_SIGNED("EDI-80206", "您已签到成功"),

    MERCHANT_USER_IS_NOT_EXIST("EDI-100001","当前用户不存在"),
    MERCHANT_USER_PWD_IS_NOT_VALID("EDI-100002","当前用户密码错误"),
    MERCHANT_NOT_ALLOW_TO_VERIFY("EDI-100003","您无权对该凭证进行核销"),
    MERCHANT_NOT_EXIST("EDI-100004","商户在系统中不存在"),
    MERCHANT_ITEM_IS_NOT_EXIST("EDI-100005","商户产品在系统中不存在"),
    MERCHANT_USER_IS_EXIST("EDI-100006","该用户在系统中已存在，请直接登录"),
    MERCHANT_IS_INVALID_VERIFY_CODE("EDI-100007","无效的验证码");


    public final String code;
    public final String desc;

    BizeTypeCode(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static boolean isSupportedBizeType(String code) {
        return USER_ALREADY_EXIST.code.equals(code) || USER_NOT_EXIST.code.equals(code) || COUPON_ALREADY_VERIFIED.code.equals(code);
    }

    public static boolean checkForMemberInfo(String code){
        return USER_ALREADY_EXIST.code.equals(code);
    }

    public static boolean checkForMemberCard(String code){
        return USER_NOT_EXIST.code.equals(code);
    }

}
